<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box {
      width: 200px;
      height: 200px;
      background-color: #000;
    }
  </style>
</head>
<body>
  <div id="box"></div>
  <input type="text" id="input" />

  <script src="./debounce&throttle.js"></script>
  <script>
    let oBox = document.getElementById('box');
    let oInput = document.getElementById('input');

    function test () {
      console.log(1)
    }

    oBox.onmouseover = debounce(test, 1000, true);
    // oBox.onmouseover = throttle(test, 1000, true);

    // oInput.onkeyup = debounce(check, 1000, true);
    oInput.onkeyup = throttle(check, 1000);

    function check() {
      let val = this.value;

      if (val.length < 6) {
        console.log('Invalid lenght');
      } else {
        console.log('Success');
      }
    }

  </script>
</body>
</html>